﻿using Marmat.Common.Http.Attributes;
using System.Collections.Generic;
using System.Net;
using System;
using System.Reflection;
using System.Text;

namespace Marmat.Common.Http
{
    internal class HttpMethodHeadersInterceptor
    {
        public void Invocation(ApiActionContext context)
        {
            var method = context.ActionDescriptor.Method;
            var attributes = method.GetCustomAttributes<HeaderAttribute>();
            foreach (var header in attributes)
            {
                context.Request.Headers[header.Name] = header.Value;
            }
        }
    }
}
